package com.cjjd.c.feature.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;

import com.cjjd.c.R;

/**
 * ----------------------------------
 * Created by xyd on 2017/10/12.
 * <p/>
 * 描  述：
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class CheckoutDialog extends Dialog implements View.OnClickListener {
    private Context mContext;
    private OnClickListener listener;

    public CheckoutDialog(Context context, OnClickListener listener) {
        super(context, R.style.loading_dialog);

        setContentView(R.layout.dialog_check_out);

        this.mContext = context;
        this.listener = listener;
        initView();
    }

    private void initView() {
        findViewById(R.id.btn_positive).setOnClickListener(this);
        findViewById(R.id.btn_negative).setOnClickListener(this);
        findViewById(R.id.quit).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_positive:
                listener.onPositiveClick();
                this.dismiss();
                break;
            case R.id.btn_negative:
                listener.onNegativeClick();
                this.dismiss();
                break;
            case R.id.quit:
                this.dismiss();
                break;
        }
    }

    public interface OnClickListener {

        public void onPositiveClick();

        public void onNegativeClick();
    }


}
